package com.example.dogliving.presenter;

import android.content.Context;

import com.example.dogliving.bean.HomeBean;
import com.example.dogliving.fragment.home.itemhomefragment.HomeAdapter;
import com.example.dogliving.homemodle.HomeModle;
import com.example.dogliving.homemodle.IHomeModle;
import com.example.dogliving.homemodle.OnLoadHomeListener;
import com.example.dogliving.view.IHomeView;


public class HomePresenter {
    private IHomeView iHomeView;
    private IHomeModle iHomeModle;
    private HomePresenter(IHomeView iHomeView){
        this.iHomeView=iHomeView;
        this.iHomeModle=new HomeModle();
    }
    public void login(final Context context){
        iHomeModle.login(new OnLoadHomeListener() {
            @Override
            public void onSucess(HomeBean homeBean) {
                HomeAdapter adapter=new HomeAdapter(context,homeBean.getData());
                iHomeView.toSetAdapter(adapter);

            }

            @Override
            public void onFailed(Throwable e) {

            }
        });
    }

}
